package com.cjack.frenchexcel.service;

import com.cjack.frenchexcel.dao.AgreementCompanyDao;
import com.cjack.frenchexcel.dao.AgreementTrialDao;
import com.cjack.frenchexcel.dao.AgreementVisitorDao;
import com.cjack.frenchexcel.table.AgreementCompanyTable;
import com.cjack.frenchexcel.table.AgreementTrialTable;
import com.cjack.frenchexcel.table.AgreementVisitorTable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by root on 4/21/19.
 */
@Service
public class AgreementService {

    @Autowired
    private AgreementTrialDao agreementTrialDao;
    @Autowired
    private AgreementCompanyDao agreementCompanyDao;
    @Autowired
    private AgreementVisitorDao agreementVisitorDao;

    public Long saveTrial( AgreementTrialTable table) {
        agreementTrialDao.save( table);
        return table.getId();
    }

    public Long saveCompany( AgreementCompanyTable table) {
        agreementCompanyDao.save( table);
        return table.getId();
    }

    public Long saveVisitor( AgreementVisitorTable table) {
        agreementVisitorDao.save( table);
        return table.getId();
    }

    public AgreementTrialTable getTrial( Long id){
        return agreementTrialDao.findOne( id);
    }

    public AgreementCompanyTable getCompany( Long id){
        return agreementCompanyDao.findOne( id);
    }

    public AgreementVisitorTable getVisitor( Long id){
        return agreementVisitorDao.findOne( id);
    }
}
